<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::domain(['admin.xud98.work'], function () {
    Route::group('login', function () {
        // 用户登录
        Route::post('index', 'Login/index');
        // 退出登录
        Route::post('logout', 'Login/logout');
        // 刷新token
        Route::post('refresh', 'Login/refresh');
    });
    // 用户管理
    Route::group('member', function () {
        // 用户登录
        // Route::post('login', 'Member/login');
        // 查看用户
        Route::post('index', 'Member/index');
        // 新增用户
        Route::post('add', 'Member/add');
        // 修改用户
        Route::post('change', 'Member/change');
        // 编辑用户
        Route::post('edit', 'Member/edit');
        // 删除用户
        Route::post('delete', 'Member/delete');
        // 获取用户权限
        Route::post('permission', 'Member/permission');
    })->middleware([app\middleware\CheckJwt::class,app\middleware\CheckAuth::class]);
    // 接口管理
    Route::group('menu', function () {
        // 查看所有接口
        Route::post('index', 'Menu/index');
        // 新增接口
        Route::post('add', 'Menu/add');
        // 修改接口
        Route::post('edit', 'Menu/edit');
    })->middleware([app\middleware\CheckJwt::class,app\middleware\CheckAuth::class]);
    // 权限管理
    Route::group('auth', function () {
        // 查看权限组
        Route::post('index', 'Auth/index');
        // 新增权限组
        Route::post('add', 'Auth/add');
        // 查看权限组拥有的权限
        Route::post('view', 'Auth/view');
        // 修改权限组
        Route::post('edit', 'Auth/edit');
    })->middleware([app\middleware\CheckJwt::class,app\middleware\CheckAuth::class]);
    // Miss 路由
    Route::miss(function() {
        return '404 Not Found!';
    });
});

